<script>

function find(arr, target){
    let result = []
    function deep(index, sum, tmpArr){
        if(sum === target){
            result.push(tmpArr.slice())
            return
        }
        if(sum > target){
            return
        }
        for(let i=index; i<arr.length; i++){
            tmpArr.push(arr[i])
            deep(i, sum+arr[i], tmpArr)
            tmpArr.pop()
        }
    }
    deep(0, 0, [])
    return result
}
let a = find([2,3,6,7], 7)
console.log(a)

</script> 